package com.pingbu.tijian.hospital.backapi.api;

import com.github.pagehelper.PageInfo;
import com.pingbu.common.bean.ResultBean;
import com.pingbu.tijian.hospital.backapi.bean.entity.StudentZuoye;
import com.pingbu.tijian.hospital.backapi.bean.entity.VideoUpload;
import com.pingbu.tijian.hospital.backapi.service.StudentZuoyeService;
import com.pingbu.tijian.hospital.backapi.service.UserPermissionService;
import com.pingbu.tijian.hospital.backapi.service.VideoUploadService;
import org.slf4j.LoggerFactory;
import org.slf4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import java.io.IOException;
import java.util.List;
import java.util.Map;

@CrossOrigin
@RestController
//@RequestMapping("")
public class VideoUploadController {

    private static Logger logger = LoggerFactory.getLogger(VideoUploadController.class);

    @Autowired
    private VideoUploadService videoUploadService;

    @PostMapping(value = "/video_upload")
    public ResultBean<Integer> video_upload( MultipartFile uploadFile1) throws IOException {
        // ROOT/yyyy-MM/dd/文件名
        ResultBean<Integer> rb1 = videoUploadService.videoPath(uploadFile1);
        return rb1;
    }

    @PostMapping(value = "/video_list")
    public ResultBean<List<VideoUpload>> video_list(@RequestBody VideoUpload param ) {
        ResultBean<List<VideoUpload>> rb1 = videoUploadService.listVideo(param);
        return rb1;
    }

    @PostMapping(value = "/video_path")
    public ResultBean<String> video_path(@RequestBody VideoUpload param ) {
        ResultBean<String> rb1 = videoUploadService.readLen(param);
        return rb1;
    }

    @PostMapping(value = "/video_delete")
    public ResultBean<List<VideoUpload>> video_delete(@RequestBody VideoUpload param ) {
        ResultBean<List<VideoUpload>> rb1 = videoUploadService.videoDelete(param);
        return rb1;
    }
}
